home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / pc2am302.lha / PC2Am / ConfigPC2Amiga next >
Text File  |  1994-03-15  |  8KB  |  249 lines

  1. ; Configuration script for the PC2Am program
  2.  
  3. ;Indicator types
  4. (set ISTR0 "None")
  5. (set ISTR1 "LED")
  6. (set ISTR2 "Gopher-like")
  7. (set ISTR3 "Background")
  8. ;(set ISTR4 "Mouse")
  9.  
  10. ;Speeds
  11. (set SPEED0 "1200")
  12. (set SPEED1 "2400")
  13. (set SPEED2 "4800")
  14. (set SPEED3 "9600")
  15. (set SPEED4 "19200")
  16. (set SPEED5 "38400")
  17. (set SPEED6 "57600")
  18. (set SPEED7 "115200")
  19.  
  20.  
  21. (procedure EditConfig
  22.  
  23.   ; Set device
  24.   (set DefDev ("DEVS:/%s" Device))
  25.   (set Device
  26.     (fileonly
  27.       (askfile
  28.         (prompt "Select device you want to use. Click on HELP for further details")
  29.         (help 
  30.           "You have to select device to communicate via. It will mostly be \"serial.device\" "
  31.           "but you can also use \"artser.device\" etc. But remember that some devices don't "
  32.           "support the Break() function (baudbandit.device), so they cannot be used."
  33.         )
  34.         (default DefDev)
  35.       )
  36.     )
  37.   )
  38.  
  39.   ; Set unit
  40.   (set Unit
  41.     (asknumber
  42.       (prompt "Select unit of the device")
  43.       (help "This will be mostly zero. You will have to change it only if you use a multiserial card.")
  44.       (default Unit)
  45.     )
  46.   )
  47.  
  48.   ; Set Flags
  49.   (set Flags
  50.     (asknumber
  51.       (prompt "Select open flags of the device")
  52.       (help "This will be mostly zero. You will have to change it only if you use a multiserial card.")
  53.       (range -2147483648 2147483647)
  54.       (default Flags)
  55.     )
  56.   )
  57.  
  58.   ; Set baud rate
  59.   ; Find baud code
  60.   (set BaudCode 0)
  61.   (while (AND (> BaudRate (+ 0 (select BaudCode SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7))) (< BaudCode 7))
  62.     (set BaudCode (+ BaudCode 1))
  63.   )
  64.   (set BaudRate
  65.     (+ 0
  66.       (select 
  67.         (askchoice 
  68.           (prompt "Select baud rate")
  69.           (choices SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7)
  70.           (default BaudCode)
  71.           (help 
  72.           "You have to select baud rate to communicate on. It is important to set "
  73.           "this baudrate to the same value on both Amiga and PC. Selecting too big "
  74.           "baudrate may cause infunctionality, low baudrates lowers transfer speed. "
  75.           "If you have at least A500 and 386SX/40, you can choose 57600."
  76.           )
  77.         )
  78.         SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7
  79.       )
  80.     )
  81.   )
  82.  
  83.   ;Set MaxTransfer
  84.   (set MaxTransfer
  85.     (asknumber
  86.       (prompt "Set maximal length of a packet.")
  87.       (range 128 8192)
  88.       (help
  89.         "Here you can set the maximal length of packet, that is transfered via "
  90.         "serial (parallel) line. Note that it is used only for sending files, "
  91.         "because other packets (open, ...) are only about 20 bytes long. So set "
  92.         "it to a lower value only when you can list directories well (listing main "
  93.         "PC: directory takes shorter packets that listing "true" directory on PC). "
  94.         "Usually, you can keep this value at least 4096 or even 8192."
  95.       )
  96.       (default MaxTransfer)
  97.     )
  98.   )
  99.  
  100.  
  101.   ;Set timeout
  102.   (set Timeout
  103.     (asknumber
  104.       (prompt "Set timeout\nNote, that it is in TENTHS of second.")
  105.       (help
  106.         "Timeout is the time, after which Amiga will try to restore "
  107.         "send PC a break, to make it reply packet etc. Good value is about"
  108.         "20 (2 secs) or a little bit more. High values do not have sense, "
  109.         "because there will be spent much time in waiting for PC. But setting "
  110.         "it too small may cause many timeouts when working with slower device "
  111.         "(floppy) or on small baud rates."
  112.       )
  113.       (default Timeout)
  114.     )
  115.   )
  116.  
  117.   ;Set progress indicator
  118.   (set IndicType
  119.     (askchoice 
  120.       (prompt "Select progress indicator type")
  121.       (choices ISTR0 ISTR1 ISTR2 ISTR3)
  122.       (default IndicType)
  123.       (help 
  124.         "Progress indicator is something that tells you the communication is "
  125.         "still working (data are transfering). Here's a description of supported "
  126.         "types:\n\n"
  127.         "NONE - No indicator will be used\n\n"        
  128.         "LED - Power LED brightness will be turned after sending each packet. "
  129.         "So when communication works, you will see LED flashing. But it may confuse "
  130.         "you, because it looks like you have been visited by a guru (system crash)."
  131.         "It may also interfere with a music playing program, because turning LED "
  132.         "turns also ON/OFF audio filter.\n\n"
  133.         "GOPHER-LIKE - In the PC2Amiga commodity window, there's a square, in which "
  134.         "you will see rotating line. But you have to popup PC2Amiga to see it, so you "
  135.         "cannot look at it all the time.\n\n"
  136.         "BACKGROUND - After sending every packet, background flashes. Maybe good for "
  137.         "some people, but for me it is too \"hard\" indication.\n\n"
  138. ;        "MOUSE - Mouse will flash as when unpacking by PowerPacker."
  139.       )
  140.     )
  141.   )
  142.  
  143.   ; Set long filenames
  144. ;  (set UseLongNames
  145. ;    (askchoice
  146. ;      (prompt "Do you want to use long filenames (not cut it to 8.3)?")
  147. ;      (choices "No" "Yes")
  148. ;      (help
  149. ;        "MS-DOS had limited filenames to eight chars, then must be a dot, and then "
  150. ;        "you can use another three chars. But Windows 95 and also OS/2 does not have "
  151. ;        "this limitations, so you can use longer filenames. (Although I don't know if "
  152. ;        "PC2Amiga works under OS/2.\n\n"
  153. ;        "If you turn on using long names, the filenames will not be cut to 8.3 chars, "
  154. ;        "and will remain as they were on Amiga. But when you will be using PC2Amiga "
  155. ;        "under DOS, you will not be able to open any file with long filename, so "
  156. ;        "don't turn this on if you don't know what you are doing."
  157. ;      )
  158. ;      (default UseLongNames)
  159. ;    )
  160. ;  )
  161. )
  162.  
  163. (if (<= (getversion (resident)) (* 37 65536))
  164.   (abort "Sorry, this script works only for systems 2.1 and later (kickstart version 37+)")
  165. )
  166.  
  167. (if (= (exists "c:GetPCSpecs") 0)
  168.   (abort "Cannot find command 'c:GetPCSpecs'. If you haven't installed PC2Amiga yet, you must do it before running this configuration script.")
  169. )
  170.  
  171. (if (= (exists "c:SetPCSpecs") 0)
  172.   (abort "Cannot find command 'c:SetPCSpecs'. If you haven't installed PC2Amiga yet, you must do it before running this configuration script.")
  173. )
  174.  
  175. (user 2)
  176.  
  177. (set FileName 
  178.   (askfile
  179.     (prompt "Please enter where you have installed the device specification file (\"PC\").")
  180.     (help
  181.       "There's a device specification file (called \"PC\"), which also contains "
  182.       "configuration data. Configuration script needs to know where it is to change "
  183.       "it. It should be either in the SYS:Storage/DOSDrivers or DEVS:DOSDrivers directory."
  184.     )
  185.     (default "SYS:Storage/DOSDrivers/PC")
  186.   )
  187. )
  188.  
  189. (if (= (exists FileName) 0)
  190.   (abort "The file you have entered does not exist !")
  191. )
  192.  
  193. (run ("GetPCSpecs %s" FileName))
  194.  
  195. ; Get original values
  196. (set Device (getenv "P2A_DEVICE"))
  197. (set Unit (+ 0 (getenv "P2A_UNIT")))
  198. (set Flags (+ 0 (getenv "P2A_FLAGS")))
  199. (set BaudRate (+ 0 (getenv "P2A_BAUD")))
  200. (set MaxTransfer (+ 0 (getenv "P2A_MAXTRANSFER")))
  201. (set Timeout (+ 0 (getenv "P2A_TIMEOUT")))
  202. (set HFlags (+ 0 (getenv "P2A_BLOCKSPERTRACK")))
  203. (set IndicType (BITAND HFlags 7))
  204. (set UseLongNames (= (BITAND HFlags 8) 1))
  205.  
  206.  
  207. (until
  208.   (= Result 1)
  209.   (EditConfig)
  210.   ; Set some vars
  211.   (set TSecs (/ Timeout 10))
  212.   (set TTent (- Timeout (* TSecs 10)))
  213.   (set Result 
  214.     (askbool
  215.       (prompt
  216.         "Confirm settings:"
  217.         ("Device: %s\nUnit: %ld\nFlags: %ld\nBaudRate: %ld\nTimeout: %ld.%lds\n" Device Unit Flags BaudRate TSecs TTent)
  218.         ("Indicator: %s\n" (select IndicType ISTR0 ISTR1 ISTR2 ISTR3))
  219.         ("Use long filenames: %s\n" (select UseLongNames "No" "Yes"))
  220.       )
  221.       (help "Script asks you to confirm your selection.")
  222.     )
  223.   )
  224. )
  225.  
  226.  
  227. ; Copy values to env vars
  228. (set HFlags (+ IndicType (* UseLongNames 8)))
  229. (textfile (dest "ENV:P2A_DEVICE") (append Device))
  230. (textfile (dest "ENV:P2A_UNIT") (append Unit))
  231. (textfile (dest "ENV:P2A_FLAGS") (append Flags))
  232. (textfile (dest "ENV:P2A_BAUD") (append BaudRate))
  233. (textfile (dest "ENV:P2A_MAXTRANSFER") (append MaxTransfer))
  234. (textfile (dest "ENV:P2A_TIMEOUT") (append Timeout))
  235. (textfile (dest "ENV:P2A_BLOCKSPERTRACK") (append HFlags))
  236.  
  237. (run ("SetPCSpecs %s T:PC" FileName))
  238.  
  239. (copyfiles
  240.   (source "t:PC")
  241.   (dest (pathonly FileName))
  242. )
  243.  
  244.  
  245. (exit "\n\nDON'T FORGET TO SETUP ALSO THE PC PART\n(USING THE \"PC2AMCFG.EXE\" PROGRAM)")
  246.  
  247. (welcome)
  248.  
  249.